#ifndef __CS5532_H
#define __CS5532_H

#include "stm32f10x.h"
#include "Drv.h"


#undef EXT
#ifndef CS5532_C
#define EXT extern
#else
#define EXT
#endif

#define FM_SI_HIGH GPIO_SetBits(GPIOA,GPIO_Pin_7)
#define FM_SI_LOW GPIO_ResetBits(GPIOA,GPIO_Pin_7)

#define FM_SCK_HIGH GPIO_SetBits(GPIOA,GPIO_Pin_5)
#define FM_SCK_LOW GPIO_ResetBits(GPIOA,GPIO_Pin_5)

#define FM_CS_ENABLE GPIO_ResetBits(GPIOC,GPIO_Pin_4)
#define FM_CS_DISABLE GPIO_SetBits(GPIOC,GPIO_Pin_4)

#define FM_SO_STATUS GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_6)


#define READ_CONFIG_REG 0x0b
#define WRITE_CONFIG_REG 0x03
#define READ_CHANNEL_REG 0x0d
#define WRITE_CHANNEL_REG 0x05

void CS5532_Initialization(void);
void ad_reset(void );
long adc_result(void);



#endif
